Linux Disk Management: Difference between revisions
Jump to navigation
Jump to search
Line 53: | Line 53: | ||
</source> |
</source> |
||
</ol> |
</ol> |
||
== Mounting Partitions == |
|||
=== Using <tt>/etc/fstab</tt> === |
|||
Run <tt>sudo blkid</tt> to get the UUID number. |
|||
<source lang="text"> |
|||
# NTFS |
|||
UUID=XXXXXXXXXXXXXXXXXXXXX /media/windows ntfs defaults,umask=007,gid=46 0 1 |
|||
</source> |
|||
Partitions can then be mounted with <tt>mount <mount-point></tt> |
|||
=== Using <tt>mount</tt> === |
|||
<source lang="bash"> |
|||
# NTFS - mount point /media/windows must be chgrp plugdev |
|||
sudo mount -t ntfs -o defaults,umask=007,gid=46 /dev/sda1 /media/windows |
|||
# SAMBA |
|||
sudo mount -t cifs -o username=baddreams,allow_utime=22,umask=002,uid=1000,gid=124 //phoenix/D$ /net/phoenix/d |
|||
</source> |
Revision as of 18:23, 12 December 2010
References
Partitions
Some CLI software:
- fdisk
- sfdisk
- parted
Some examples:
$ sudo fdisk -l /dev/sda # Show partition table for device /dev/sda
$ sudo fdisk -l -u /dev/sda # ... using sector as unit
$ sudo parted -l # Show partition table of all devices
$ sudo parted /dev/sda print # ... of only device /dev/sda
$ sudo parted /dev/sda unit cyl print # ... using cylinder as unit
$ sudo parted /dev/sda unit s print # ... using sector as unit (more accurate)
$ sudo sfdisk -l -uS /dev/sda # Show partition table for device /dev/sda
$ sudo sfdisk -d /dev/sda >sda-sfdisk.dump # Dump partition in a format that can be understood by sfdisk
$ sudo sfdisk /dev/sda <sda-sfdisk.dump # Restore a dumped partition table
$ sudo dd if=/dev/sda of=sda.mbr bs=512 count=1 # Save the complete MBR (table + boot code)
Use partprobe to force the kernel to re-read the MBR (re-read the partition table, see [1]). Or alternatively one can use fdisk to re-rewrite the same partition and force a re-read. And that are more solutions too ([2]):
$ sudo partprobe
# Or use fdisk
$ sudo fdisk /dev/sda
Command: v
Command: w
# Or use blockdev
$ sudo /sbin/blockdev --rereadpt /dev/hda
# Or use sfdisk
$ sudo sfdisk -R /dev/sda
Resizing Partitions
Reiserfs
- Use resize_reiserfs to resize the partition, and get the new partition size
- Change the partition table
- Run reiserfsck
resize_reiserfs -s -4G /dev/sda6 #Must be unmount
df
sudo sfdisk -d /dev/sda >sda-sfdisk.dump # Edit sda-sfdisk.dump
sudo reiserfsck --rebuild-sb
sudo reiserfsck --fix-fixable
Mounting Partitions
Using /etc/fstab
Run sudo blkid to get the UUID number.
# NTFS
UUID=XXXXXXXXXXXXXXXXXXXXX /media/windows ntfs defaults,umask=007,gid=46 0 1
Partitions can then be mounted with mount <mount-point>
Using mount
# NTFS - mount point /media/windows must be chgrp plugdev
sudo mount -t ntfs -o defaults,umask=007,gid=46 /dev/sda1 /media/windows
# SAMBA
sudo mount -t cifs -o username=baddreams,allow_utime=22,umask=002,uid=1000,gid=124 //phoenix/D$ /net/phoenix/d