[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: root partition (writable) on USB Stick



Op 20100511 om 20:43 schreef wuschel:
> I have a Windows USB Stick creator  
> <http://www.linuxusbdownload.com/Debian?XTCsid=d22d7ebf8593c0710b1f44e5efcca29a> 
> for Debian live created.
> Unfortunately it is for the persistent mode, not possible with the known  
> to me and available tools in Windows, a second partition with ext2 to  
> create. Is it possible the file initrd.img or vmlinuz to edit, around a  
> live-rw storage file on the root partition (writable) to use.

That reads as "I don't have access to a Linux system",
but Debian Live IS a Linux system.

And the "repair system" can repair itself ...

Boot the USB stick and have a good look at the output of
  mount

The important thing is that you recognise the device that is the USB
stick. To help finding the device
  mount | awk '/^\/dev/ { print $1}'

Lets assume the output was "/dev/sdb1",
so the complete USB stick is "/dev/sdb"  ( Your Milage May Vary )

With that knowledge the work can begin, but only as root
  sudo su -

Next step would making an extra partition
  fdisk /dev/sdb

Create a special device for it
  mknod /dev/sdb2 b 8 18

Tell the kernel that the partition exists
  partx -a /dev/sdb2 /sdb

Make a file system on it
  mkfs -t ext2 /dev/sdb2

And then "label" it
  e2label /dev/sdb2 live-rw


Now an extra writeable partition exists, enjoy it!


Groeten
Geert Stappers

Details:
stappers@wyse:~$ mount
aufs on / type aufs (rw)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/hdc1 on /live/image type vfat
(ro,noatime,fmask=0022,dmask=0022,allow_utime=177777,codepage=cp437,iocharset=utf8)
tmpfs on /live/cow type tmpfs (rw,noatime,mode=755)
tmpfs on /live type tmpfs (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
stappers@wyse:~$ 
stappers@wyse:~$ mount | awk '/^\/dev/ {print $1 }'
/dev/hdc1
stappers@wyse:~$ 
stappers@wyse:~$ sudo su -
wyse:~# fdisk -l /dev/hdc

Disk /dev/hdc: 256 MB, 256901120 bytes
255 heads, 63 sectors/track, 31 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00082cfc

   Device Boot      Start         End      Blocks   Id  System
/dev/hdc1   *           1          15      120456   83  Linux
wyse:~# fdisk /dev/hdc

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (16-31, default 16): 
Using default value 16
Last cylinder or +size or +sizeM or +sizeK (16-31, default 31): +16M

Command (m for help): p

Disk /dev/hdc: 256 MB, 256901120 bytes
255 heads, 63 sectors/track, 31 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00082cfc

   Device Boot      Start         End      Blocks   Id  System
/dev/hdc1   *           1          15      120456   83  Linux
/dev/hdc2              16          18       24097+  83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or
resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
wyse:~# fdisk -l /dev/hdc

Disk /dev/hdc: 256 MB, 256901120 bytes
255 heads, 63 sectors/track, 31 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00082cfc

   Device Boot      Start         End      Blocks   Id  System
/dev/hdc1   *           1          15      120456   83  Linux
/dev/hdc2              16          18       24097+  83  Linux
wyse:~# mkfs -t ext2 /dev/hdc2
mke2fs 1.41.3 (12-Oct-2008)
Could not stat /dev/hdc2 --- No such file or directory

The device apparently does not exist; did you specify it correctly?
wyse:~# cat /proc/partitions 
major minor  #blocks  name

  22     0     250880 hdc
  22     1     120456 hdc1
   7     0     103212 loop0
wyse:~# 

     CHIPS

wyse:~# ls -l /dev/hdc /dev/hdc1 /dev/hdc2
ls: cannot access /dev/hdc2: No such file or directory
brw-rw---- 1 root disk 22, 0 2010-05-12 11:43 /dev/hdc
brw-rw---- 1 root disk 22, 1 2010-05-12 10:17 /dev/hdc1
wyse:~# mknod /dev/hdc2 b 22 2
wyse:~# ls -l /dev/hdc /dev/hdc1 /dev/hdc2
brw-rw---- 1 root disk 22, 0 2010-05-12 11:43 /dev/hdc
brw-rw---- 1 root disk 22, 1 2010-05-12 10:17 /dev/hdc1
brw-r--r-- 1 root root 22, 2 2010-05-12 12:06 /dev/hdc2
wyse:~# mkfs -t ext2 /dev/hdc2
mke2fs 1.41.3 (12-Oct-2008)
mkfs.ext2: No such device or address while trying to determine filesystem size
wyse:~# 


    CHIPS CHIPS

wyse:~# cat /proc/partitions
major minor  #blocks  name

  22     0     250880 hdc
  22     1     120456 hdc1
   7     0     103212 loop0
wyse:~# partx /dev/hdc
wyse:~# partx -a /dev/hdc
BLKPG: Device or resource busy
error adding partition 1
wyse:~# man partx
wyse:~# partx -a /dev/hdc2 /dev/hdc
wyse:~# cat /proc/partitions
major minor  #blocks  name

  22     0     250880 hdc
  22     1     120456 hdc1
  22     2      24097 hdc2
   7     0     103212 loop0
wyse:~# mkfs -t ext2 /dev/hdc2
mke2fs 1.41.3 (12-Oct-2008)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
6024 inodes, 24096 blocks
1204 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=24903680
3 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks: 
	8193

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

wyse:~# e2label /dev/hdc2 live-rw
wyse:~# 

Attachment: signature.asc
Description: Digital signature


Reply to: